﻿using System;
using System.Collections.Generic;
using System.Web;

/// <summary>
///PagingParameter 的摘要说明
/// </summary>
[Serializable]
public class PagingParameter
{
    private int _totalCount;
    public int TotalCount
    {
        get { return _totalCount; }
        set { _totalCount = value; }
    }

    private int _pageSize;
    public int PageSize {
        get { return _pageSize; }
        set { _pageSize = value; }
    }

    private int _currentPageIndex;
    public int CurrentPageIndex
    {
        get
        {
            if (_currentPageIndex > PageCount) return PageCount;
            if (_currentPageIndex < 0) return 0;
            return _currentPageIndex;
        }
        set
        {
            _currentPageIndex = value;
        }
    }

    public int PageCount
    {
        get {
            if (PageSize == 0) return 0;
            if (TotalCount == 0) return 0;
            return (TotalCount % PageSize == 0 ? TotalCount / PageSize : (TotalCount / PageSize) + 1);
        }
    }

	public PagingParameter()
	{
		//
		//TODO: 在此处添加构造函数逻辑
		//
	}
}